﻿Public Class TheKho

    Private Sub TheKho_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        'load tháng hiện tại
        Me.TuNgayIDateEdit.EditValue = getNgayDauThang(Today)
        Me.DenNgayIDateEdit.EditValue = getNgayCuoiThang(Today)
        Me.IGridControl.ForceInitialize()
        'Me.BarButtonItemLamTuoi.PerformClick()
        'Me.GetTCTonKho_TheKho_TheoLo_HanDungTableAdapter.Fill(Me.PCV_CLINICDataSetTongHop.getTCTonKho_TheKho_TheoLo_HanDung, getRecycleId(CDate(Me.TuNgayIDateEdit.EditValue)))
        setSoLuongCuoiKy()
    End Sub

    Private Shadows Sub BarButtonItemLamTuoi_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemLamTuoi.ItemClick
        'Me.GetTCTonKho_TheKho_TheoLo_HanDungTableAdapter.Fill(Me.PCV_CLINICDataSetTongHop.getTCTonKho_TheKho_TheoLo_HanDung, getRecycleId(CDate(Me.TuNgayIDateEdit.EditValue)))
        setSoLuongCuoiKy()
    End Sub
    Private Sub setSoLuongCuoiKy()
        If True Then
            Dim tondauky, soluongnhap, soluongxuat As Decimal
            For index = 0 To Me.IGridView1.RowCount - 1
                If index <> 0 Then
                    tondauky = Me.IGridView1.GetRowCellValue((index - 1), "soluongdauky")
                    soluongnhap = Me.IGridView1.GetRowCellValue((index), "soluongnhap")
                    soluongxuat = Me.IGridView1.GetRowCellValue((index), "soluongxuat")
                    Me.IGridView1.SetRowCellValue(index, "soluongcuoiky", tondauky + soluongnhap - soluongxuat)
                End If
            Next
        End If
    End Sub

    Private Sub RadioGroup1_SelectedIndexChanged(sender As Object, e As EventArgs)

    End Sub
End Class
